<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<style type="text/css">
			*{
				margin: 0;
				padding: 0;
			}
			.box{
				width: 100px;
				height: 100px;
				background: red;
			}
		</style>
		<script src="js/touchjs.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div class="box"></div>
	</body>
	<script type="text/javascript">
			//触摸屏幕时
			touch.on('.box', 'touchstart', function(ev){
				ev.preventDefault();
			});
			var box = document.getElementsByClassName("box")[0];
			var dx = 0, dy = 0;
			//开始拖拽
			touch.on('.box', 'drag', function(ev){
				dx = dx || 0;
				dy = dy || 0;
				var offx = dx + ev.x + "px";
				var offy = dy + ev.y + "px";
				this.style.webkitTransform = "translate3d(" + offx + "," + offy + ",0)";
			});
			//拖拽结束
			touch.on('.box', 'dragend', function(ev){
				dx += ev.x;
				dy += ev.y;
			});
	</script>
</html>
